package cn.llyong.rpc.common.bo;

import java.io.Serializable;

/**
 * @description:
 * @author: llyong
 * @date: 2020年06月26日 00:36
 */
public class RpcService implements Serializable {

    private static final long serialVersionUID = 1L;


    /**
     * 应用名
     */
    private String appName;
    /**
     * 服务接口名
     */
    private String serviceItf;
    /**
     * 服务ip
     */
    private String serverIp;
    /**
     * 服务端口
     */
    private int serverPort;
    /**
     * 超时时间
     */
    private long timeout;
    /**
     * 该服务提供者权重
     */
    private int weight;
    /**
     * 服务端线程数
     */
    private int workerThreads;
    /**
     * 服务提供者唯一标识
     */
    private String appKey;
    /**
     * 服务分组组名
     */
    private String groupName;

    public RpcService() {
    }

    public RpcService(String appName, String serviceItf, String serverIp, int serverPort, long timeout, int weight, int workerThreads, String appKey, String groupName) {
        this.appName = appName;
        this.serviceItf = serviceItf;
        this.serverIp = serverIp;
        this.serverPort = serverPort;
        this.timeout = timeout;
        this.weight = weight;
        this.workerThreads = workerThreads;
        this.appKey = appKey;
        this.groupName = groupName;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getServiceItf() {
        return serviceItf;
    }

    public void setServiceItf(String serviceItf) {
        this.serviceItf = serviceItf;
    }

    public String getServerIp() {
        return serverIp;
    }

    public void setServerIp(String serverIp) {
        this.serverIp = serverIp;
    }

    public int getServerPort() {
        return serverPort;
    }

    public void setServerPort(int serverPort) {
        this.serverPort = serverPort;
    }

    public long getTimeout() {
        return timeout;
    }

    public void setTimeout(long timeout) {
        this.timeout = timeout;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }

    public int getWorkerThreads() {
        return workerThreads;
    }

    public void setWorkerThreads(int workerThreads) {
        this.workerThreads = workerThreads;
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"appName\":\"")
                .append(appName).append('\"');
        sb.append(",\"serviceItf\":\"")
                .append(serviceItf).append('\"');
        sb.append(",\"serverIp\":\"")
                .append(serverIp).append('\"');
        sb.append(",\"serverPort\":")
                .append(serverPort);
        sb.append(",\"timeout\":")
                .append(timeout);
        sb.append(",\"weight\":")
                .append(weight);
        sb.append(",\"workerThreads\":")
                .append(workerThreads);
        sb.append(",\"appKey\":\"")
                .append(appKey).append('\"');
        sb.append(",\"groupName\":\"")
                .append(groupName).append('\"');
        sb.append('}');
        return sb.toString();
    }
}
